package org.swust.sysmonitorapp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.swust.sysmonitorapp.entity.AlertThreshold;

@Mapper
public interface AlertThresholdMapper extends BaseMapper<AlertThreshold> {
    @Update("UPDATE alert_thresholds SET heart_rate_min = #{threshold.heartRateMin}, " +
            "heart_rate_max = #{threshold.heartRateMax}, spo2_min = #{threshold.spo2Min}, " +
            "is_active = #{threshold.isActive}, updated_at = NOW() " +
            "WHERE device_id = #{threshold.deviceId}")
    int updateThreshold(@Param("threshold") AlertThreshold threshold);
}